<template>
  <el-container style=" border: 1px solid #eee">
<!--    <el-header style="text-align: right; font-size: 12px;background-color: gray">-->
<!--      <span style="font-size: 16px">欢迎！{{ admin.username }}</span>-->
<!--      <el-button style="background-color: gray;color: black;border: gray;font-size: 8px" @click="exit()">退出登录</el-button>-->
<!--    </el-header>-->
    <el-header style="font-size: 12px;background-color: gray">
      <div style="float: right;display: inline">
      <span style="font-size: 16px;">欢迎！{{ admin.username }}</span>
        <el-button style="background-color: gray;color: black;border: gray;font-size: 16px" @click="exit()" class="el-icon-circle-close">退出登录</el-button>
      </div>
      <div style="display: inline">
        <span style="font-size: 20px;color: white" class="el-icon-s-home">中小学教学质量信息采集及评估系统</span>
      </div>
    </el-header>
    <el-container>
<!--      <el-header style="text-align: right; font-size: 12px;background-color: gray">-->
<!--        <span style="font-size: 16px">欢迎！{{ admin.username }}</span>-->
<!--        <el-button style="background-color: gray;color: black;border: gray;font-size: 8px" @click="exit()">退出登录</el-button>-->
<!--      </el-header>-->
      <el-aside width="200px" style="background-color: #304156">
        <el-menu
          router
          :default-openeds="['1','2','1-1']"
          :background-color="variables.menuBg"
          :active-text-color="variables.menuActiveText"
          :text-color="variables.menuText">
          <!--        v-if="item.show" 控制边栏板块的展示-->
          <!--        <el-submenu v-for="(item,index) in $router.options.routes" :index="index+''" v-if="item.show">-->
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-setting"></i>系统管理</template>
            <router-link to="AdminList" active-class="active"><el-menu-item><i class="el-icon-user"></i>管理员账号</el-menu-item></router-link>
            <router-link to="SchoolUserList" active-class="active"><el-menu-item><i class="el-icon-user"></i>学校账号</el-menu-item></router-link>
            <router-link to="ExpertList" active-class="active"><el-menu-item><i class="el-icon-user"></i>专家账号</el-menu-item></router-link>
<!--            <router-link to="SchoolList" active-class="active"><el-menu-item><i class="el-icon-s-order"></i>学校列表</el-menu-item></router-link>-->
<!--            <router-link to="SchoolHost" active-class="active"><el-menu-item><i class="el-icon-s-custom"></i>学校举办者</el-menu-item></router-link>-->
<!--            <router-link to="SchoolType" active-class="active"><el-menu-item><i class="el-icon-news"></i>学校类型</el-menu-item></router-link>-->
<!--            <router-link to="SchoolLocationType" active-class="active"><el-menu-item><i class="el-icon-location-information"></i>学校驻地城乡类型</el-menu-item></router-link>-->
            <el-submenu index="1-1">
              <template slot="title"><i class="el-icon-school"></i>学校信息管理</template>
              <router-link to="SchoolList" active-class="active"><el-menu-item><i class="el-icon-s-order"></i>学校列表</el-menu-item></router-link>
              <router-link to="SchoolHost" active-class="active"><el-menu-item><i class="el-icon-s-custom"></i>学校举办者</el-menu-item></router-link>
              <router-link to="SchoolType" active-class="active"><el-menu-item><i class="el-icon-news"></i>学校类型</el-menu-item></router-link>
              <router-link to="SchoolLocationType" active-class="active"><el-menu-item><i class="el-icon-location-information"></i>驻地城乡类型</el-menu-item></router-link>
            </el-submenu>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-edit-outline"></i>评估管理</template>
            <router-link to="EvaluateIndexList" active-class="active"><el-menu-item><i class="el-icon-s-tools"></i>评估体系设置</el-menu-item></router-link>
            <router-link to="EvaluateTaskList" active-class="active"><el-menu-item><i class="el-icon-document"></i>评估任务定义</el-menu-item></router-link>
<!--            <router-link to="EvaluateIndex123" active-class="active"><el-menu-item><i class="el-icon-school"></i>评估指标</el-menu-item></router-link>-->
            <router-link to="EvaluateTaskArrange" active-class="active"><el-menu-item><i class="el-icon-files"></i>评估安排</el-menu-item></router-link>
            <!--          <router-link to="SchoolLocationType" active-class="active"><el-menu-item>学校驻地城乡类型</el-menu-item></router-link>-->
            <!--          <router-link to="test" active-class="active"><el-menu-item>测试</el-menu-item></router-link>-->
          </el-submenu>
          <!--        <el-submenu v-for="(item,index) in $router.options.routes" :index="index+''" v-if="item.show">-->
<!--          <el-submenu index="3">-->
<!--            <template slot="title"><i class="el-icon-setting"></i>系统管理</template>-->
<!--            <router-link to="AdminList" active-class="active"><el-menu-item><i class="el-icon-user"></i>管理员账号</el-menu-item></router-link>-->
<!--            <router-link to="SchoolUserList" active-class="active"><el-menu-item><i class="el-icon-user"></i>学校账号</el-menu-item></router-link>-->
<!--            <router-link to="ExpertList" active-class="active"><el-menu-item><i class="el-icon-user"></i>专家账号</el-menu-item></router-link>-->
<!--            &lt;!&ndash;          <router-link to="test" active-class="active"><el-menu-item>测试</el-menu-item></router-link>&ndash;&gt;-->
<!--            &lt;!&ndash;          <router-link to="SchoolLocationType" active-class="active"><el-menu-item>学校驻地城乡类型</el-menu-item></router-link>&ndash;&gt;-->
<!--            &lt;!&ndash;          <router-link to="test" active-class="active"><el-menu-item>测试</el-menu-item></router-link>&ndash;&gt;-->
<!--          </el-submenu>-->
        </el-menu>
      </el-aside>

      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import variables from '@/assets/variables.scss'
export default {
  name: "index",
  data(){
    return{
      admin:''
    }
  },
  methods:{
    exit(){
      const d=confirm("确定退出吗？");
      if(d){
        this.$router.push("/login")
      }

    }
  },
  created() {
    const a=localStorage.getItem("access-admin")
    if(a){
      this.admin=JSON.parse(window.localStorage.getItem('access-admin'))
    }
    else{
      this.$alert('未登录','提示',{
        confirmButtonText:'确定'
      }).then((res)=>{
        this.$router.replace({path:'/login'})
      })
    }
  },
  computed:{
    variables() {
      return variables
    },
  }
}
</script>

<style scoped>
a {
  text-decoration: none;
}

.router-link-active {
  text-decoration: none;
}
.el-menu-item{
  background-color: #333333;
  color: white;
}
.el-submenu{
  background-color: #333333;

}
.el-submenu__title{
  color: white;
}

</style>
